<template>
	<view>
		<view class="news-list" style="padding: 20rpx;background-color: #fff;">
			<view class="news-item" v-for="item in newsList" style="display: flex;flex-direction: row;
			justify-content: space-between;padding: 20rpx 0;border-top: 2rpx solid #e4e7ed;">
				<view class="left" style="width: 450rpx;">
					<view class="top" style="height: 168rpx;">
						<text class="line" style="font-weight: bold;font-size: 32rpx;">{{item.title}}</text>
						<rich-text class="line" style="font-size: 26rpx;" :nodes="item.content"></rich-text>
					</view>
					<view class="bottom" style="display: flex;flex-direction: row;font-size: 22rpx;
					color: #666;">
						<text>{{item.readNum}} 阅读</text>
						<text>{{item.publishDate}}</text>
					</view>
				</view>
				<view class="right center">
					<navigator :url="`/pages/news-detail/news-detail?id=${item.id}`">
						<image :src="$baseUrl + item.cover" mode="" style="width: 250rpx;height: 200rpx;"></image>
					</navigator>
				</view>
			</view>
			<u-divider>没有更多了</u-divider>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				newsList: []
			};
		},
		onLoad(option) {
			this.getNews(option.key)
		},
		methods:{
			getNews(key){
				this.$request({
					url: '/prod-api/press/press/list'
				}).then(res => {
					console.log(res)
					this.newsList = res.rows.filter(item => item.title.includes(key))
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
